<?php
namespace Home\Model;
use Think\Model;
class UserOpenModel extends Model {

    protected $insertFields = array('sc_id', 'time', 'plan', 'result');
    protected $updateFields = array('id', 'sc_id', 'plan', 'time', 'result');
    protected $_validate = array(
        array('time', 'require', '时间不能为空！', 1, 'regex', 3),
        array('plan', 'require', '计划项不能为空！', 1, 'regex', 3),
        array('plan', '1,100', '计划项最长不能超过 100 个字符！', 1, 'length', 3),
    );
    public $rules = array(
        array('result', 'require', '计划执行效果不能为空！', 1, 'regex', 3),
        array('result', '1,50', '计划项最长不能超过 50 个字符！', 1, 'length', 3),
    );

    

    protected function _before_insert(&$data, $options) {
        $time = I('post.time');

        $data['time'] = strtotime($time);
    }

    protected function _before_update(&$data, $options) {
        
    }

}
